
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<?php 
if(isset($_POST['button'])){
    echo '姓名:'.$_POST['username'].'<br>';
    echo '密码:'.$_POST['pwd'].'<br>';
    echo '性别:'.$_POST['sex'].'<br>';
    echo '爱好:',isset($_POST['hobby'])?implode(',',$_POST['hobby']):'没有爱好','<br>';
    echo '籍贯:'.$_POST['jiguan'].'<br>';
    echo '留言:'.$_POST['words'];


    // print_r($_POST['hobby']) ;
}
?>
    <form action="" method='post'>
    姓名: <input type="text" name='username'><br />
    密码： <input type="password" name='pwd'><br />
    性别: <input type="radio" name='sex' value='1'>男
    <input type="radio" name='sex' value='0'>女
    爱好: <input type="checkbox" name='hobby[]' value='爬山'>爬山
    <input type="checkbox" name='hobby[]' value='抽烟'>抽烟
    <input type="checkbox" name='hobby[]' value='喝酒'>喝酒
    <input type="checkbox" name='hobby[]' value='烫头'>烫头<br />
    
    籍贯:
    <select name="jiguan" id="">
    <option value="021">上海</option>
    <option value="010">北京</option>
    </select>
    留言:
    <textarea name="words" id="5" cols="30" rows="5"></textarea>
    <input type="submit" name='button' value='提交'>
    </form>
</body>
</html>